package mahi.thread;

public class JoinExample {
	public static void main(String[] args) {
		
		Runnable r = new Runnable() {
			@Override
			public void run() {
				try {
					System.out.println("in child thread");
					Thread.sleep(10000);
				} catch (InterruptedException e) {
					e.printStackTrace();
				}
				
			}
		};
		
		
		
		Thread t = new Thread(r);
		t.start();
		
		
		
		try {
			t.join();
		} catch (InterruptedException e) {
			e.printStackTrace();
		}
		System.out.println("in main thread");
		
	
	}
	
	
}
